<?php
class Perbuatan_detil_model extends MY_Model {
	
    function Perbuatan_detil_model(){
        parent::MY_Model();
        $this->load->database();
        $this->table_name = "perbuatan_detil";
        $this->table_fields = array('perb_id','kary_id','kary_jbt_id','detachiev_id','deperb_point','deperb_count');
    }
    
    function select_last_entry($search_key=false, $where=false, $limit=10, $offset=0, $orderby=""){
    }
    
    function select_by_perbuatan($perbuatan_id){
    	$this->select('*');
    	$this->join('prestasi_pelanggaran_detil', 'prestasi_pelanggaran_detil.detachiev_id='.$this->table_name.'.detachiev_id');
    	$this->join('prestasi_pelanggaran', 'prestasi_pelanggaran.achiev_id=prestasi_pelanggaran_detil.achiev_id');
    	return $this->get_where(array('perb_id'=>$perbuatan_id));
    }
        
    function select_by_id($id){
    	return $query = $this->db->get_where($this->table_name, array('propinsi_id' => $id));
    }
    
    function is_exist($perb_id, $kary_id){
    	$res = $this->get_where("perb_id='$perb_id' AND kary_id='$kary_id'");
    	if ($res->row()) return true;
    	return false;
    }
}